﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WPFTestDemo
{
    public class KeyBoardHelper
    {
        private static event EventHandler ShowKeyBoardEvent;

        /// <summary>
        /// 引发显示键盘事件，由控件是否获取焦点调用。
        /// </summary>
        /// <param name="sener"></param>
        /// <param name="args"></param>
        public static void RaiseShowKeyBoardEvent(object sener, EventArgs args)
        {
            ShowKeyBoardEvent?.Invoke(sener, args);
        }

        /// <summary>
        /// 订阅显示键盘事件，由你的键盘类调用。
        /// </summary>
        /// <param name="eventHandler"></param>
        public static void AddShowKeyBoardHandler(EventHandler eventHandler)
        {
            ShowKeyBoardEvent += eventHandler;
        }

        /// <summary>
        /// 取消订阅键盘事件，由你的键盘类调用。
        /// </summary>
        /// <param name="eventHandler"></param>
        public static void RemoveShowKeyBoardHandler(EventHandler eventHandler)
        {
            ShowKeyBoardEvent -= eventHandler;
        }
    }
}
